Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pyproject.toml build file #238

Merged
merged 1 commit into from
May 11, 2023
Merged

Add pyproject.toml build file #238

merged 1 commit into from
May 11, 2023

Conversation

xxyzz
Copy link
Contributor

@xxyzz xxyzz commented Apr 27, 2023

This fixes the pip install error when adding Lupa source code as dependency in other packages' pyproject.toml file because Lupa's setup.py doesn't install Cython automatically.

Example pyproject.toml:

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "mypackage"
version = "0.0.1"
dependencies = [
    "lupa @ git+https://github.com/scoder/lupa.git"
]

@xxyzz
Copy link
Contributor Author

xxyzz commented May 11, 2023

Hi @scoder, could you please review this minor change if you have the time?

@scoder
Copy link
Owner

scoder commented May 11, 2023

Note that setup.py now has a build_requires line. And there's also a requirements.txt. I'd rather not triplicate the dependencies across even more files.

@xxyzz
Copy link
Contributor Author

xxyzz commented May 11, 2023

But setuptools doesn't recognize the build_requires keyword. It has setup_requires and install_requires, but that would install Cython as normal dependency instead of build dependency package and Cython is not installed when prepare_extensions() is running according to the build log.

@scoder
Copy link
Owner

scoder commented May 11, 2023

But setuptools doesn't recognize the build_requires keyword.

Understood. so that can probably be removed. Still, the GHA and appveyor scripts both use requirements.txt, so that is the single point of truth. Is there a way to make pyproject.toml use requirements.txt?

@xxyzz
Copy link
Contributor Author

xxyzz commented May 11, 2023

Is there a way to make pyproject.toml use requirements.txt?

Probably not, project.dependencies can use dynamic metadata to set a file but not for build-system.requires.

setuptools doesn't have `build_requires` keyword. By using the
`setup_requires` keyword, `pip install --use-pep517` will be able to
install Cython before building package.
@xxyzz
Copy link
Contributor Author

xxyzz commented May 11, 2023

I removed the pyproject.toml file and replaced the invalid build_requires keyword with setup_requires. Now Cython can be installed with pip install's --use-pep517 option.

@scoder scoder merged commit d22da03 into scoder:master May 11, 2023
@scoder
Copy link
Owner

scoder commented May 11, 2023

Thanks

@xxyzz xxyzz deleted the setup branch May 11, 2023 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants